#ifndef TREEVIEWMODEL_H
#define TREEVIEWMODEL_H

#include <QAbstractItemModel>
#include "treenode.h"

class TreeViewModel : public QAbstractItemModel
{
public:
    TreeViewModel();

    virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
    virtual QModelIndex parent(const QModelIndex &index) const;
    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    virtual QHash<int, QByteArray> roleNames() const;
private:
    QList<TreeNodePtr> mRootEntrys;
    void addEntryNode(TreeNodePtr node,TreeNodePtr parent=0);
    QHash<int, QByteArray> mRoleNames;
};

#endif // TREEVIEWMODEL_H
